package edu.zut.main.thread;

public class ThreadDemo {

    public static void main(String[] args) {

        System.out.println("main begin....");
        //启动子线程
        new Thread(new chileThread()).start();

        System.out.println("main stop....");

    }

}
//子线程
class chileThread implements Runnable{
    //子线程任务
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            //假设这个循环执行结束需要10s
            try {
                //让当前线程休眠100毫秒
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("循环执行....");
        }
    }
}




